﻿// -----------------------------------------------------------------------
// <copyright file="MenuUsingInterface.cs" company="">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Ex04.Menus.Test
{
    using System;
    using System.Collections.Generic;
    using System.Text;
    using Ex04.Menus.Interfaces;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class MenuUsingInterface
    {
        private readonly MainMenu r_MainMenu = new MainMenu();

        public MenuUsingInterface()
        {
            IPerformTheAction actionFunction1 = new ActionToPerform.ActionToPerform1();
            IPerformTheAction actionFunction2 = new ActionToPerform.ActionToPerform2();
            IPerformTheAction actionFunction3 = new ActionToPerform.ActionToPerform3();
            IPerformTheAction actionFunction4 = new ActionToPerform.ActionToPerform4();
            IPerformTheAction actionFunction5 = new ActionToPerform.ActionToPerform5();
            IPerformTheAction actionFunction6 = new ActionToPerform.ActionToPerform6();
            IPerformTheAction actionFunction7 = new ActionToPerform.ActionToPerform7();
            IPerformTheAction actionFunction8 = new ActionToPerform.ActionToPerform8();

            Action action1 = new Action("First Action", actionFunction1);
            Action action2 = new Action("Second Action", actionFunction2);
            Action action3 = new Action("Third Action", actionFunction3);
            Action action4 = new Action("Fourth Action", actionFunction4);
            Action action5 = new Action("Fifth Action", actionFunction5);
            Action action6 = new Action("Sixth Action", actionFunction6);
            Action action7 = new Action("Seventh Action", actionFunction7);
            Action action8 = new Action("Eighth Action", actionFunction8);

            SubMenu subMenu1 = new SubMenu("First subMenu interface ", r_MainMenu.NameOfMain);
            SubMenu subMenu2 = new SubMenu("Second subMenu interface ", r_MainMenu.NameOfMain);
            SubMenu subMenu3 = new SubMenu("Third subMenu interface: ", r_MainMenu.NameOfMain);
            SubMenu subMenu4 = new SubMenu("Fourth subMenu interface: ", r_MainMenu.NameOfMain);

            subMenu3.AddMenuItem(action4);
            subMenu3.AddMenuItem(action5);

            subMenu1.AddMenuItem(action3);
            subMenu1.AddMenuItem(subMenu3);

            subMenu4.AddMenuItem(action7);
            subMenu4.AddMenuItem(action8);

            subMenu2.AddMenuItem(action6);
            subMenu2.AddMenuItem(subMenu4);

            r_MainMenu.AddNewItem(subMenu1);
            r_MainMenu.AddNewItem(subMenu2);
            r_MainMenu.AddNewItem(action1);
            r_MainMenu.AddNewItem(action2);

            r_MainMenu.Show();
        }
    }
}
